package cn.edu.scau.cmi.dengyu.singleton;

import java.util.HashSet;
import java.util.Set;

public class Marshal {

	private String name;
	private static Set<Marshal> marshalSet=new HashSet<Marshal>();
	
	private Marshal(String name) {
		this.setName(name);
	}
	
	
	public static Set<Marshal> addInstance(String name) {
		if(marshalSet.size()<10) {
			Marshal marshal = new Marshal(name);
			marshalSet.add(marshal);
		}
		return marshalSet;
		
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}
}
